/**
 * Created by dale on 2017/9/12.
 */
$(document).ready(function () {


    var form = new xhForm($('#xh_form'));
    form.parse();
    var id=addressUri.getParam('id');
    var iTypeId=addressUri.getParam('iTypeId');
    if(iTypeId!=undefined){
        $('[name="iTypeId"]').val(iTypeId);
    }
    if(prodInfo!=1){
        form.fill(prodInfo);
    }
    form.bindRequired($('#bt_modal_confirm',parent.document));

    $('#bt_modal_confirm',parent.document).click(function () {
        $.ajax({
            url:baseUrl+'ims/product/saveProduct',
            data:$('#xh_form').serialize(),
            type:'POST',
            success:function (data) {
                $('#bt_modal_confirm',parent.document).addClass('disabled');
                window.top.xhTop.closeModal();
                window.top.xhTop.getActiveFrame().prodList.datagrid('reload');
            },
            error:function (data) {
                window.top.swal(
                    data['responseText'],
                    '',
                    'error'
                );
                // window.top.swal(data[''])
            }
        });
    });

    // modalBind.bindClick();

});